import httpInstant from '../utils/http';

/**
 * @description 获取评论列表
 * @param current 当前页数
 * @param pageSize 每页条数
 * @param postId 帖子id
 * @returns
 */
export function getCommentListApi({
  currentPage,
  pageSize,
  postId
}) {
  return httpInstant.get('comment/getCommentList', {
    params: {
      currentPage,
      pageSize,
      postId,
    }
  });
}



/**
 * @description 添加评论接口
 * @param  userId 用户id
 * @param  postId 帖子id
 * @param  content 评论内容
 * @returns
 */
export function submitCommentApi({
  userId,
  postId,
  content,
  imgList
}) {

  return httpInstant.post('comment/addComment', {
    postId,
    content,
    userId,
    imgList
  });
}


/**
 * @description 删除评论接口
 * @param  commentId 评论id
 * @returns
 */
export function deleteCommentApi({
  commentId
}) {

  return httpInstant.delete('comment/deleteComment', {
    params: {
      commentId
    }
  });
}


/**
 * @description 获取帖子最后一条评论接口
 * @param  postId 帖子id
 * @returns
 */
export function getPostLastCommentApi({
  postId
}) {
  console.log(postId);

  return httpInstant.get('comment/getPostLastComment', {
    params: {
      postId
    }
  });
}